﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Caching;

namespace _18miljard.Partners
{
	public class PartnerCache
	{
		internal static PartnerCollector Partners
		{
			get
			{
				string cacheName = "data_partners";

				PartnerCollector partners = DataCache.Cache[cacheName] as PartnerCollector;

				if (partners == null)
				{
					partners = new PartnerCollector();

					CacheDependency dependency = new CacheDependency(HttpContext.Current.Server.MapPath("/App_Data/Partners.xml"));

					DataCache.ExpireNextDay(cacheName, partners, dependency);
				}

				return partners;
			}
		}
	}
}